
#ifndef LIST_T_F_H
#define LIST_T_F_H

/**
 * @file
 * List_t full interface.
 */

#include "List_t.h"


/**
 * A double link.
 */
struct ListLink_t
{
    /** The stored element. */
    void * element;

    /** The next link. */
    struct ListLink_t * next;

    /** The previous link.*/
    struct ListLink_t * prev;
};


/** @brief Convenience typedef. */
typedef struct ListLink_t ListLink_t;



/**
 * @name A double linked list.
 */
struct List_t
{
    /** @brief Callback to destroy elements. */
    void ( * elementDestructor )( void * );

    /** @brief The list head. */
    ListLink_t * head;

    /** @brief The list tail. */
    ListLink_t * tail;
};


/**
 * @name List init and destroy methods.
 */

/**
 * Initializes list internal fields.
 * This is the constructor of the list.
 *
 * @param The list to initialize.
 * @param elementDestructor The element destructor.
 * @return 0 on failure.
 */
int list_construct( List_t * thisList, void ( * elementDestructor)( void * ) );

/**
 * Destroies list internal fields.
 * This is the destructor of the list.
 *
 * @param The list to destroy.
 */
void list_destroy( List_t * thisList );


/*@}*/

#endif
